#include <iostream>
#include <time.h>      // Timer
#include <inttypes.h>  // Unix Time-Cast
#include <string>
#include <stdlib.h>


#include "engine.h"




using namespace std;


// Anzupassende Time Funktionen
int getUnixTime() {
    int retWert;
    time_t Zeit=time(NULL);
    retWert = (uintmax_t)Zeit; // Cast to UNIX time
    return retWert;
}




int main() {

    int BufferZeit = 0;

    engine serverEngine;
    serverEngine.debug = 1;

    serverEngine.Init();

    do {

        serverEngine.feedInput(getch());
        serverEngine.Tick();


        if(BufferZeit != getUnixTime()) {
            BufferZeit = getUnixTime();

            serverEngine.Draw();
            serverEngine.TickSecond();

        }



    } while(serverEngine.flagDestroy==0);


    return 0;
}
